<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <button id="btn1">请求</button>
</body>
<script src="../jquery.js"></script>
<script>

    // 提前配置将来ajax的公共选项
    $.ajaxSetup({
        url:"./data/data.php",
        data:{
            username:"admin"
        }
    })

    $("#btn1").click(function(){
        // 开启具体的ajax请求
        $.ajax({
            success:(res, state, xhr)=>{
                alert(res)
            }
        })
        $.ajax({
            data:{
                username:"root"
            },
            success:(res, state, xhr)=>{
                console.log(res)
            }
        })
        $.ajax({
            success:(res, state, xhr)=>{
                document.write(res)
            }
        })
    })
</script>
</html>